home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Rendering Diagnostics...
- // FileName: renderChecker.mel
- // Usage: "renderChecker #triangles_limit",
- // where #triangles_limit is what you consider to be a high
- // tessellation count; we recommend 10000.
- //
- // Maya Limitations.
- // This script searches for the following scenarios specific to Maya3.0:
- // - motion blur limitations
- // - output image file format restrictions
- // - byframe of 0 causing hang
- // - fractional byframe requiring modify ext
- // - no renderable cameras or weird combination
- // - 2d blur with colored background will have artifacts
- // - large far/near clipping plane values cause artifacts
- // - reflection gets incorrect normal when bumped
- // - instanced light not work too well
- // - zero-scale items not rendered
- //
- // The following Warnings may be issued:
- // - no lights warning
- // - composite rendering warning
- // - RT global flag on but no real RT being requested
- // - RT shadows turned on but RT global flag is not
- // - small filter value warning
- // - misuse of the "useMaximumRes" attribute causing flickering
- // - file texture name delimited by "." warning
- // - bump map does not work with file texture's advanced filtering
- // - missing file texture warning
- // - SG with no ports connected
- // - object with no SG associated
- // - screen-space tessellation resulting in flicker
- // - dangling volume primitives (fog/glow)
- // - shadow map reuse may be dangerous due to autofocus
- // - shader glow flicker with auto-exposure turned on
- //
- // Warnings for the following scenarios which affect Performance:
- // - suggestion of using 2d motion blur instead of 3d motion blur
- // - RT warning, and RT limits
- // - high shading sample warning
- // - high visibility sample warning
- // - lots of textures not using file caching warning
- // - inefficient use of layered shader causing slowdown
- // - avoid RT shadows
- // - avoid large filter size values for shadow map
- // - avoid large shadow map resolution
- // - output objects with high tessellation count (nurbs + subdivs)
- // - degree 1 tessellation suggestion
- //
-
- global string $renderableCamera;
-
- global proc renderChecker(int $numTri)
- {
- print "\nStarting diagnostics...\n\n\n";
- print "Known Problems/Limitations\n";
- print "--------------------------\n";
- maya1_0_bugs_diagnostic();
- print "\n";
-
- print "Warnings\n";
- print "--------\n";
- warning_diagnostic();
- print "\n";
-
- print "Speed/Memory Implications\n";
- print "-------------------------\n";
- performance_diagnostic($numTri);
- print "\n\nDiagnostic Completed...\n\n";
- }
-
-
- global proc maya1_0_bugs_diagnostic()
- {
- string $renderQuality[] = `listConnections defaultRenderGlobals.qual`;
-
- if (`getAttr defaultRenderGlobals.mb` &&
- `getAttr ($renderQuality[0] + ".ert")`)
- {
- print " - motion blur and raytracing are both turned on. Please note\n";
- print " that reflections, refractions and shadows are not motion blurred.\n";
- }
-
- if (`getAttr defaultRenderGlobals.mb`)
- {
- print " - you have motion blur turned on. Be aware that particles,\n";
- print " lights and shadows do not motion blur. As well, motion\n";
- print " blurred shadows may produce artifacts - a thorough discussion\n";
- print " of the shadowing issues is available in the rendering release notes.\n";
- }
-
- int $format = `getAttr defaultRenderGlobals.outf`;
- if ($format != 7 && $format != 10)
- {
- if ($format == 3 || $format == 4)
- {
- print " - you have specified output to the TIFF format. This will write out LZW\n";
- print " compressed TIFF images for version 5. Applications which can only handle\n";
- print " version 4 TIFF may not be able to read Maya's TIFF images. A possible\n";
- print " workaround is to write to uncompressed TIFF images, which can be achieved\n";
- print " by typing \"setenv IMF_TIFF_COMPRESSION none\". Uncompressed TIFF is also\n";
- print " ideal for Zap!It.\n";
- }
-
- if ($format == 12)
- {
- print " - you have specified output to the Quantel format. This format may only\n";
- print " be output to NTSC/PAL/HDTV resolutions, and does not output to fields.\n";
- print " If the above restrictions are not met, rendering will default to IFF\n";
- print " image output.\n";
- }
-
- if ($format == 11)
- {
- print " - you have specified output to the Cineon format. This format\n";
- print " will not render out a mask channel.\n";
- }
-
- if ($format == 0 || $format == 8 || $format == 9)
- {
- print " - output to GIF/EPS/JPEG formats will result in the mask channel not being\n";
- print " written.\n";
- }
- }
-
- if (`getAttr defaultRenderGlobals.an` && `getAttr defaultRenderGlobals.bfs` == 0.0)
- {
- print " - the animation by-frame step is 0. Please be aware that this may result\n";
- print " in an infinite loop - 0 for by-frame is not meaningful.\n";
- }
-
- if (`getAttr defaultRenderGlobals.an` && `getAttr defaultRenderGlobals.me` == 0 &&
- `getAttr defaultRenderGlobals.bfs` > -1.0 && `getAttr defaultRenderGlobals.bfs` < 1.0)
- {
- print " - you have specified a fractional animation by-frame step. This will result\n";
- print " in images over-writing each other for fractional frame counts. Please\n";
- print " remember to turn on the modify-extension.\n";
- }
-
-
- int $gotRenderableCamera = 0;
- string $allCameras[] = `ls -ca`;
- global string $renderableCamera;
- for ($i = 0; $i < size($allCameras); $i++)
- {
- if (`getAttr ($allCameras[$i] + ".rnd")`)
- {
- $gotRenderableCamera = 1;
- $renderableCamera = $allCameras[$i];
- if (`getAttr ($allCameras[$i] + ".img")` == 0)
- print (" - " + $allCameras[$i] + "'s rendering won't have the color channel written out.\n");
- if (`getAttr ($allCameras[$i] + ".bfc")` == 0 &&
- `getAttr ($allCameras[$i] + ".fcp")` / `getAttr ($allCameras[$i] + ".ncp")` > 100000.0)
- {
- print (" - " + $allCameras[$i] + "'s near/far clipping values are too far apart - you may\n");
- print " enounter numerical imprecision resulting in incorrect renders.\n";
- }
- }
- }
- if ($gotRenderableCamera == 0)
- print " - there are no renderable cameras in your scene.\n";
-
- if (`getAttr defaultRenderGlobals.mb` && `getAttr defaultRenderGlobals.mbt` == 0)
- {
- for ($i = 0; $i < size($allCameras); $i++)
- {
- if (`getAttr ($allCameras[$i] + ".rnd")`)
- {
- if (`getAttr ($allCameras[$i] + ".colr")` != 0 ||
- `getAttr ($allCameras[$i] + ".colg")` != 0 ||
- `getAttr ($allCameras[$i] + ".colb")` != 0) {
- print " - 2d motion blur is used with a colored background. This will likely\n";
- print " produce edge artifacts. Turning on the 2d motion blur's 'smooth color'\n";
- print " attribute will resolve those artifacts.\n";
- break;
- }
- }
- }
- }
-
-
- string $allShaders[] = `ls -materials`;
- for ($i = 0; $i < size($allShaders); $i++)
- {
- string $ntype = `nodeType $allShaders[$i]`;
- if ($ntype == "blinn" || $ntype == "phong" || $ntype == "phongE" || $ntype == "lambert" || $ntype == "anisotropic")
- {
- string $bump[] = `listConnections ($allShaders[$i] + ".n")`;
- string $refl[] = `listConnections ($allShaders[$i] + ".c")`;
- string $refl2[];
- if ($ntype != "lambert")
- $refl2 = `listConnections ($allShaders[$i] + ".rc")`;
- if (size($bump) != 0 && size($refl) != 0 && size($refl2) != 0)
- {
- $ntype = `nodeType $refl[0]`;
- if ($ntype == "envBall" || $ntype == "envChrome" ||
- $ntype == "envCube" || $ntype == "envSky")
- {
- print (" - " + $allShaders[$i] + " has both its bump and environment map connected. Please be\n");
- print " aware of the limitation that the reflection will not be bumped unless you\n";
- print " invoke a MEL proc - cnctBumpProjNormal MATERIAL - see rendering release notes.\n";
- }
- }
- }
- }
-
-
- string $allLights[] = `ls -lights`;
- for ($i = 0; $i < size($allLights); $i++)
- {
- string $ntype = `nodeType $allLights[$i]`;
- if ($ntype == "spotLight" || $ntype == "pointLight" || $ntype == "volumeLight" || $ntype == "areaLight")
- {
- string $transf[] = `ls -dag -ap ($allLights[$i])`;
- if (size($transf) > 1)
- {
- print (" - " + $allLights[$i] + " appears to be an instanced light. It is best\n");
- print " to avoid instanced lights - copying lights would be recommended.\n";
- }
- }
- }
-
- zeroScale_problem();
- }
-
-
- global proc warning_diagnostic()
- {
- string $renderQuality[] = `listConnections defaultRenderGlobals.qual`;
- string $rez[] = `listConnections defaultRenderGlobals.res`;
-
- string $lights[] = `ls -lights`;
- if (size($lights) == 0 && `getAttr defaultRenderGlobals.enableDefaultLight` == 0)
- print " - you have no lights to illuminate your scene.\n";
-
- if (`getAttr defaultRenderGlobals.comp`)
- {
- print " - you have turned on composite rendering. Be aware that the\n";
- print " rendering will appear aliased, but will be ideal once you complete\n";
- print " your compositing work.\n";
- }
-
- int $i;
- string $allShapes[] = `ls -dag -typ shape`;
- if (`getAttr ($renderQuality[0] + ".ert")`)
- {
- if (`getAttr ($renderQuality[0] + ".rfl")` == 0)
- print " - no RT reflections will be rendered (renderQuality's global RT reflection control is switched off).\n";
- if (`getAttr ($renderQuality[0] + ".rfr")` == 0)
- print " - no RT refractions will be rendered (renderQuality's global RT refraction control is switched off).\n";
- if (`getAttr ($renderQuality[0] + ".sl")` == -1)
- print " - no RT shadows will be rendered (renderQuality's global RT shadow control is switched off).\n";
-
- int $gotERT = 0;
- for ($i = 0; $i < size($allShapes); $i++)
- {
- string $type = `objectType $allShapes[$i]`;
- switch ($type)
- {
- case "subdiv":
- case "nurbsSurface":
- case "mesh":
- case "polymesh":
- case "particle":
- if (`getAttr ($allShapes[$i] + ".visibleInReflections")` ||
- `getAttr ($allShapes[$i] + ".visibleInRefractions")`)
- $gotERT = 1;
- break;
- }
- if ($gotERT) break;
- }
- string $allLights[] = `ls -lights`;
- for ($i = 0; $i < size($allLights); $i++)
- {
- if (`getAttr ($allLights[$i] + ".urs")`)
- $gotERT = 1;
- }
- if ($gotERT == 0)
- print " - raytracing is turned on, but no objects have been marked for raytracing.\n";
- }
- else
- {
- int $gotRTshadows = 0;
- string $allLights[] = `ls -lights`;
- for ($i = 0; $i < size($allLights); $i++)
- {
- if (`getAttr ($allLights[$i] + ".urs")`)
- $gotRTshadows = 1;
- }
- if ($gotRTshadows)
- {
- print " - raytracing shadows are specified but the render globals' raytracing flag\n";
- print " is not turned on. Those raytracing shadows will not be computed.\n";
- }
- }
-
-
- int $i;
- string $allTextures[] = `ls -textures`;
- for ($i = 0; $i < size($allTextures); $i++)
- {
- if (`nodeType $allTextures[$i]` == "file" && `getAttr ($allTextures[$i] + ".f")` < 0.1)
- {
- print (" - " + $allTextures[$i] + "'s filter value is very small. This can result in bad aliasing.\n");
- if (`getAttr ($allTextures[$i] + ".ft")` != 1)
- print " Furthermore, performance can be severely affected when used with non-mipmap mode.\n";
- }
- if (`nodeType $allTextures[$i]` == "file" && `getAttr ($allTextures[$i]
- + ".umr")`)
- {
- print (" - " + $allTextures[$i] + " has useMaximumRes turned on. This attribute is not intended\n");
- print (" to provide highest image quality, but use the highest resolution in the mipmap.\n");
- print (" As such, it may even produce undersirable artifacts. To turn it off, type:\n");
- print (" setAttr " + $allTextures[$i] + ".umr 0.\n");
-
- }
- if (`nodeType $allTextures[$i]` == "file" && `getAttr ($allTextures[$i] + ".ufe")`)
- {
- string $tmp[];
- string $filename = `getAttr ($allTextures[$i] + ".ftn")`;
- tokenize ($filename, ".", $tmp);
- if (size ($tmp) > 2)
- {
- print (" - " + $allTextures[$i] + "'s file texture name has more than one '.' delimiter.\n");
- print " This may produce erroneous frame parsing for animated textures. Please refer\n";
- print " to the rendering release notes for more information on this restriction.\n";
- }
- }
- if (`nodeType $allTextures[$i]` == "file")
- {
- int $resolutionX = `getAttr ($allTextures[$i] + ".outSizeX")`;
- int $resolutionY = `getAttr ($allTextures[$i] + ".outSizeY")`;
- if ($resolutionX == 0 || $resolutionY == 0)
- {
- print (" - " + $allTextures[$i] + " is missing a file texture on disk.\n");
- }
- }
- }
-
-
- string $sets[] = `ls -sets`;
- for ($i = 0; $i < size($sets); $i++)
- {
- if (`sets -q -renderable $sets[$i]`)
- {
- string $ss[] = `listConnections ($sets[$i] + ".surfaceShader")`;
- string $vs[] = `listConnections ($sets[$i] + ".volumeShader")`;
- if (size($ss) == 0 && size($vs) == 0)
- print (" - " + $sets[$i] + " has no port connected. This can be dangerous for rendering.\n");
- }
- }
-
-
- string $activeObjects[] = `ls -sl`;
- int $firsttime = 1;
- for ($i = 0; $i < size($allShapes); $i++)
- {
- string $type = `objectType $allShapes[$i]`;
- switch ($type)
- {
- case "subdiv":
- case "mesh":
- case "polymesh":
- case "renderCone":
- case "renderSphere":
- case "directedDisc":
- int $j;
- string $sets[] = `listConnections ($allShapes[$i] + ".iog")`;
- for ($j = 0; $j < size($sets); $j++)
- if (`objectType ($sets[$j])` == "shadingEngine" &&
- `sets -q -renderable ($sets[$j])`) break;
- if ($j == size($sets))
- {
- if ($firsttime == 1)
- {
- $firsttime = 0;
- }
- select -r $allShapes[$i];
- string $shadingGroup[] = `ls -sl -type shadingEngine`;
- if (size($shadingGroup) == 0)
- {
- if ( $type == "renderCone" || $type == "renderSphere" || $type == "directedDisc" )
- {
- print (" - " + $allShapes[$i] + " has no shading group associated with it. This\n");
- print " means that it will not be rendered. This is usually a residue of\n";
- print " disconnection of light fog/glow. You may wish to delete this.\n";
- }
- else
- {
- print (" - " + $allShapes[$i] + " has no shading group associated with it. This\n");
- print " means that it will not be rendered. Please assign it to a shading group.\n";
- }
- }
- }
- break;
-
- case "nurbsSurface":
- case "particle":
- int $j;
- string $sets[] = `listConnections ($allShapes[$i] + ".iog")`;
- for ($j = 0; $j < size($sets); $j++)
- if (`objectType ($sets[$j])` == "shadingEngine" &&
- `sets -q -renderable ($sets[$j])`) break;
- if ($j == size($sets))
- {
- print (" - " + $allShapes[$i] + " has no shading group associated with it. This\n");
- print " means that it will not be rendered. Please assign it to a shading group.\n";
- }
-
- if (`attributeQuery -exists -node $allShapes[$i] modeU`)
- {
- if (`getAttr ($allShapes[$i] + ".modeU")` == 4 ||
- `getAttr ($allShapes[$i] + ".modeV")` == 4)
- {
- print (" - " + $allShapes[$i] + " is tesselated with the screen-space option.\n");
- print " If this object also contains a solid texture, the different tessellations\n";
- print " over an animation may result in the appearance of solid texture flicker.\n";
- }
- }
- break;
- }
- }
-
- volumeGeomTest();
-
- string $allStrokes[] = `ls -type stroke`;
- global string $renderableCamera;
- if (size($allStrokes) != 0) {
- // There are Paint Effects strokes in the scene.
- // First, check if the depth type on the camera is ideally suited to Paint Effects.
- if (`getAttr ($renderableCamera + ".depthType")` == 0) {
- if (`getAttr ($renderableCamera + ".transparencyBasedDepth")` == 0) {
- print(" - " + $renderableCamera + "'s Output Settings, Depth Type is set to 'Closest Visible Depth',\n");
- print(" 'Transparency Based Depth' is OFF and there are Paint Effects strokes in the scene. This can\n");
- print(" result in a halo-like rim around objects which have Paint Effects behind them. To fix this,\n");
- print(" open the Attribute Editor for the renderable camera (in this case " + $renderableCamera + ")\n");
- print(" and in the Output Settings section, select Depth, and set Depth Type to 'Furthest Visible Depth'.\n");
- print(" If you require 'Closest Visible Depth' for some other reason, select 'Transparency Based Depth'\n");
- print(" and set the 'Threshold' low enough to avoid the fringing. Start at a value of .25 and see if the\n");
- print(" halo fringes around your objects are gone the next time you render. If not, you will need to reduce\n");
- print(" the Threshold value further.\n");
- }
- }
- // Secondly, check that the lights in the scene do not have Mid-dist or raytracing shadows enabled.
- string $allLights[] = `ls -lights`;
- for ($i = 0; $i < size($allLights); $i++)
- {
- string $ntype = `nodeType $allLights[$i]`;
- if ($ntype == "spotLight" || $ntype == "pointLight" || $ntype == "volumeLight" || $ntype == "directionalLight")
- {
- // These light types can have depth mapped shadows.
- if (`getAttr ($allLights[$i] + ".useDepthMapShadows")`) {
- if (`getAttr($allLights[$i] + ".useMidDistDmap")`) {
- print(" - " + $allLights[$i] + " is casting depth map shadows with 'Use Mid Dist Dmap' enabled and there\n");
- print(" are Paint Effects strokes in the scene. Paint Effects strokes may not shadow correctly or may not\n");
- print(" cast shadows correctly if 'Use Mid Dist Dmap' is on for shadow maps. It is best to de-select the\n");
- print(" 'Use Mid Dist Dmap' option for shadow casting lights when Paint Effects are in the scene.\n");
- }
- }
- }
- if (`getAttr( $allLights[$i] + ".useRayTraceShadows")`) {
- print(" - " + $allLights[$i] + " has 'Use Ray Trace Shadows' selected and there are Paint Effects strokes in the scene.\n");
- print(" Paint Effects strokes cannot cast raytrace shadows, they can only cast depth map shadows or fake shadows\n");
- print(" (as specified on the brush). Paint Effects strokes will also not be visible in raytraced reflections and\n");
- print(" refractions. If you wish to raytrace Paint Effects, you will need to devise reflection mapping or\n");
- print(" compositing solutions.\n");
- }
- }
- if (`getAttr ("defaultRenderGlobals.onlyRenderStrokes")`) {
- print(" - The Render Globals Paint Effects Rendering Option 'Only Render Strokes' is enabled. This means that\n");
- print(" a primary rendering pass is not being performed, only strokes will be rendered. A consequence of this\n");
- print(" is that shadow maps are not being generated so shadowing of Paint Effects strokes, and the shadows of\n");
- print(" Paint Effects strokes may be wrong. To have shadows properly cast onto Paint Effects strokes, be sure\n");
- print(" that the lights in the scene have their 'Disk Based Dmaps' attribute set to 'Reuse Existing Dmap(s)'.\n");
- print(" To have Paint Effects strokes cast shadows properly, do a shadow map rendering pass before rendering\n");
- print(" your geometry image; set all shadow depth map producing light's 'Disk Base Dmaps' to 'Overwrite Existing\n");
- print(" Dmap(s)' and render the full scene with 'Only Render Strokes' de-selected (OFF). Then set the 'Disk Based Dmaps'\n");
- print(" back to 'Reuse Existing Dmap(s)' and 'Enable Stroke Rendering' de-selected, and then render the geometry\n");
- print(" only pass.\n");
- string $depthFile = `getAttr ("defaultRenderGlobals.strokesDepthFile")`;
- if ($depthFile == "") {
- print(" - The Render Globals Paint Effects Rendering Option 'Only Render Strokes' is enabled, but you have\n");
- print(" not supplied a source depth file for the Paint Effects to render against. This means that all Paint\n");
- print(" Effects strokes will render regardless of their visibility when they are composited into your final\n");
- print(" scene. If the file you supply as a depth file has no color information, the Paint Effects strokes\n");
- print(" will render against the background color. If the depth file has color, the Paint Effects strokes will\n");
- print(" render against the depth file's image. Allowing Paint Effects to render against the depth file's image\n");
- print(" will produce superior results to what a post-process compositing package can do. The Paint Effects\n");
- print(" rendering process uses a multi-depth buffer compositing process which cannot be duplicated in a\n");
- print(" post-process composite. See the Paint Effects documentation for more information on how to use\n");
- print(" 'Only Render Strokes' to add Paint Effects to existing images (which is the best way to use non-Maya\n");
- print(" renderers and combine Paint Effects with their output.\n");
- }
- }
- }
-
-
- for ($i = 0; $i < size($lights); $i++)
- {
- string $ntype = `nodeType $lights[$i]`;
- if ($ntype == "directionalLight" || $ntype == "spotLight" ||
- $ntype == "pointLight" || $ntype == "volumeLight" || $ntype == "areaLight")
- {
- if (`getAttr ($lights[$i] + ".useDmapAutoFocus")` &&
- `getAttr ($lights[$i] + ".reuseDmap")` &&
- `getAttr ($lights[$i] + ".useDepthMapShadows")`)
- {
- print(" - " + $lights[$i] + " has auto focus + reuse depth map turned on.\n");
- print(" This may cause inconsistent shadow results if you produced the\n");
- print(" the shadow map, then changed any of the angle of view, turned on/off\n");
- print(" the shadow casting option for some objects, transformed objects,\n");
- print(" turned off the auto focus, etc. Might be best to turn off auto focus\n");
- print(" when you produce the shadow map.\n");
- }
- }
- }
-
- // Warning about glow flicker with auto-exposure on.
- int $autoExposureOn = 0;
- string $shaderGlowNode[] = `ls -type shaderGlow`;
- for ($i = 0; $i < size($shaderGlowNode); $i++)
- {
- if (`getAttr ($shaderGlowNode[$i] + ".autoExposure")`)
- {
- $autoExposureOn = 1;
- break;
- }
- }
- if ($autoExposureOn)
- {
- int $glowFlickerWarning = 0;
- string $shaders[] = `ls -mat`;
- for ($i = 0; $i < size($shaders); $i++)
- {
- if (`attributeQuery -exists -node $shaders[$i] glowIntensity` &&
- `getAttr ($shaders[$i] + ".glowIntensity")` > 0.0)
- {
- $glowFlickerWarning = 1;
- break;
- }
- }
- if ($glowFlickerWarning)
- {
- print " - there is shader glow in your scene, and autoExposure is turned on.\n";
- print " This may cause glow flicker over an animation. To remedy this,\n";
- print " render one frame in which the glow intensity looks desirable, then\n";
- print " apply the normalization factor (from the rendering output) as the\n";
- print " glow intensity to the shader glow node, and also turn off autoExposure.\n";
- print " For more information, please refer to the rendering reference manual.\n";
- }
- }
-
-
- if ($firsttime == 0)
- {
- select -r $activeObjects;
- }
- }
-
-
- global proc performance_diagnostic(int $numTri)
- {
- string $renderQuality[] = `listConnections defaultRenderGlobals.qual`;
- string $rez[] = `listConnections defaultRenderGlobals.res`;
-
- if (`getAttr defaultRenderGlobals.mb` &&
- `getAttr defaultRenderGlobals.mbt` == 1)
- {
- print " - you have 3d motion blur turned on. Since v2, there is a new feature\n";
- print " utilizing 2d motion blur which should work just as well, except\n";
- print " with rotational blurring. With 2d motion blur, rendering will be\n";
- print " much faster, and a much lower shading sampling rate is needed.\n";
- }
-
- if (`getAttr ($renderQuality[0] + ".ert")`)
- {
- print " - you have raytracing turned on. Keep in mind that raytracing is\n";
- print " inherently slow and the memory usage tends to be very large.\n";
- if (`getAttr ($renderQuality[0] + ".rfl")` > 2)
- {
- print " - the raytrace reflection limit is very high. This can result\n";
- print " very long rendering times, particularly with a high refraction\n";
- print " limit and transparent surfaces.\n";
- }
- }
-
- if (`getAttr ($renderQuality[0] + ".ss")` > 3)
- {
- print " - your render quality's shading sample value is quite high. This\n";
- print " will slow down the render times. If the image quality is not high enough,\n";
- print " it is best to increase the maximum shading samples value or turn on multi-\n";
- print " pixel filtering. If that does not work, consider decreasing the contrast\n";
- print " threshold values (see Contrast Sensitive Production preset) to anti-\n";
- print " alias details better. If that fails, please refer to the user manual,\n";
- print " \"Optimizing Maya's Renderer\", for tricks + tips to get better image quality.\n";
- }
-
- if (`getAttr defaultRenderGlobals.mb` &&
- `getAttr ($renderQuality[0] + ".mvs")` > 2)
- {
- print " - your render quality's visibility sample value is quite high. This\n";
- print " will slow down the render times. If the image quality is not high enough,\n";
- print " it is best to increase the maximum visibility samples value first. If it\n";
- print " does not work, please refer to the user manual, under \"Optimizing Maya's\n";
- print " Renderer\" for tricks + tips to get better image quality.\n";
- }
-
- int $i;
- int $numFileTextures = 0;
- string $allTextures[] = `ls -textures`;
- for ($i = 0; $i < size($allTextures); $i++)
- {
- if (`nodeType $allTextures[$i]` == "file" && `getAttr ($allTextures[$i] + ".uca")` == 0)
- $numFileTextures = $numFileTextures + 1;
- }
- if ($numFileTextures > 20)
- {
- print " - you have quite a few file textures in use. You might want to consider\n";
- print " using texture file caching to reduce memory usage.\n";
- }
-
-
- string $shadingGroup[] = `ls -type shadingEngine`;
- for ($i = 0; $i < size($shadingGroup); $i++)
- {
- string $members[] = `sets -query $shadingGroup[$i]`;
- if (size($members) > 0)
- {
- string $shaderls[] = `listConnections ($shadingGroup[$i] + ".surfaceShader")`;
- if (size($shaderls) != 0 &&
- `nodeType $shaderls[0]` == "layeredShader")
- {
- print (" - '" + $shaderls[0] + "' is a layered shader at the top level.\n");
- print " It would be more optimal for the lambert/phong/phongE shader\n";
- print " to be at the top level of the shading network, and layer\n";
- print " textures in the rest of the shading network.\n";
- }
- }
- }
-
-
- string $allLights[] = `ls -lights`;
- for ($i = 0; $i < size($allLights); $i++)
- {
- if (`getAttr ($allLights[$i] + ".urs")`)
- {
- print (" - " + $allLights[$i] + " has raytrace shadows turned on. Raytrace shadows\n");
- print " can be expensive. Doing depth map shadows may be more economical, and\n";
- print " should be used unless transparent shadows are desired.\n";
- }
- if (`attributeQuery -exists -node $allLights[$i] dms` &&
- `getAttr ($allLights[$i] + ".dms")`)
- {
- if (`getAttr ($allLights[$i] + ".fs")` > 5)
- {
- print (" - " + $allLights[$i] + " has the shadow map filter set at a very\n");
- print " high value. This can make shadow map rendering very expensive.\n";
- print " We recommend that this value be lowered.\n";
- }
- if (`getAttr ($allLights[$i] + ".dr")` > 1024)
- {
- print (" - " + $allLights[$i] + " has the shadow map resolution set at a very\n");
- print " high value. Note that the shadow blockiness artifact has been fixed\n";
- print " and thus you don't need high resolution maps to get good shadow quality.\n";
- }
- }
- }
-
-
- string $allShapes[] = `ls -g -ap`;
- int $hasDefaultNurbTessellation = 0;
- for ($i = 0; $i < size($allShapes); $i++)
- {
- if (`objectType $allShapes[$i]` == "nurbsSurface") {
- tessellationCount ($allShapes[$i], $numTri);
-
- // Does the scene contain at least one nurb surface with default
- // tessellation? If the tessellation was automatically set,
- // explicit tessellation is enabled.
-
- if (! `getAttr ($allShapes[$i]+".explicitTessellationAttributes")`) {
- $hasDefaultNurbTessellation = 1;
- }
- }
-
- if (`objectType $allShapes[$i]` == "subdiv") {
- int $ofc = `getAttr ($allShapes[$i] + ".ofc")`;
- int $sc = `getAttr ($allShapes[$i] + ".sc")`;
- int $d = `getAttr ($allShapes[$i] + ".d")` - 1;
- if ($d < 0) $d = 0;
- int $powResult = `pow 4 $d`;
- int $subdivCount = 2 * $ofc * $powResult * $sc * $sc;
- if (`getAttr ($allShapes[$i] + ".featureDisplacement")`) {
- string $sets[] = `listConnections ($allShapes[$i] + ".iog")`;
- for ($j = 0; $j < size($sets); $j++) {
- if (`objectType ($sets[$j])` == "shadingEngine" &&
- `sets -q -renderable ($sets[$j])`) {
- string $displ[] = `listConnections ($sets[$j] +
- ".displacementShader")`;
- if (size($displ) > 0) {
- int $srate = `getAttr ($allShapes[$i] + ".dsr")`;
- $subdivCount = ($subdivCount * $srate * $srate) / 2.0;
- break;
- }
- }
- }
- }
- if ($subdivCount > $numTri) {
- print (" - " + $allShapes[$i] + " has a high tessellation count: " + $subdivCount + ".\n");
- print " It will be worthwhile to reduce the tessellation amount.\n";
- }
- }
- }
-
- // Is there at least one surface with default tessellation ?
-
- if ($hasDefaultNurbTessellation) {
- // The user probably hasn't run "Set NURBS Tessellation".
-
- print " - using Render->Set NURBS Tessellation[] can improve image quality\n";
- print " and reduce render time by automatically setting the optimum\n";
- print " tessellation based on distance from the camera. The tessellation\n";
- print " can be computed for multiple surfaces across all frames in the\n";
- print " animation.\n";
- }
-
- print " - it can be useful to run your scene through \"maya -optimizeRender\"\n";
- print " before rendering. This can help optimize the scene for rendering.\n";
- }
-
-
- global proc tessellationCount (string $nodeName, int $numTri)
- {
- string $nodeAttrNumberU = $nodeName + ".numberU";
- string $nodeAttrNumberV = $nodeName + ".numberV";
- string $nodeAttrModeU = $nodeName + ".modeU";
- string $nodeAttrModeV = $nodeName + ".modeV";
- string $nodeAttrSpansU = $nodeName + ".spansU";
- string $nodeAttrSpansV = $nodeName + ".spansV";
- string $nodeAttrExpert = $nodeName + ".eta";
- string $nodeAttrFactU = $nodeName + ".nufa";
- string $nodeAttrFactV = $nodeName + ".nvfa";
- string $nodeAttrCurvTol = $nodeName + ".cvto";
- string $nodeAttrEdgeSm = $nodeName + ".ues";
- int $valueU = `getAttr $nodeAttrNumberU`;
- int $valueV = `getAttr $nodeAttrNumberV`;
- int $modeU = `getAttr $nodeAttrModeU`;
- int $modeV = `getAttr $nodeAttrModeV`;
- int $spansU = `getAttr $nodeAttrSpansU`;
- int $spansV = `getAttr $nodeAttrSpansV`;
- int $expert = `getAttr $nodeAttrExpert`;
- float $factU = `getAttr $nodeAttrFactU`;
- float $factV = `getAttr $nodeAttrFactV`;
- int $curvTol = `getAttr $nodeAttrCurvTol`;
- int $edgeSm = `getAttr $nodeAttrEdgeSm`;
-
- int $number = 0;
- int $minimal_subdiv = 0;
-
- if (!$expert)
- {
- if ($factU <= 1.5 && $factV <= 1.5) $minimal_subdiv = 1;
-
- $factU = $factU * (float)$spansU;
- $factV = $factV * (float)$spansV;
- $number = $factU * $factV * 2.0;
- }
- else if ($modeU == 4 || $modeV == 4)
- {
- // If the mode is 4, we will really use mode 2 internally,
- // and it is tough to estimate what number will be set, but
- // we know the minimum.
- $number = $spansU * $spansV * 2; // At a minimum.
- }
- else
- {
- if ($modeU == 1 || $modeU == 2)
- {
- $number = $valueU;
- }
- if ($modeU == 3)
- {
- $number = $spansU * $valueU;
- }
- if ($modeV == 1 || $modeV == 2)
- {
- $number = $number * $valueV;
- }
- if ($modeV == 3)
- {
- $number = $number * ($spansV * $valueV);
- }
- $number = $number * 2; // Each quadrilateral is split into 2 triangles.
- }
-
- if ($edgeSm) $number = $number * 2;
-
- if (`getAttr ($nodeName + ".featureDisplacement")`) {
- int $j;
- string $sets[] = `listConnections ($nodeName + ".iog")`;
- for ($j = 0; $j < size($sets); $j++) {
- if (`objectType ($sets[$j])` == "shadingEngine" &&
- `sets -q -renderable ($sets[$j])`) {
- string $displ[] = `listConnections ($sets[$j] +
- ".displacementShader")`;
- if (size($displ) > 0) {
- int $srate = `getAttr ($nodeName + ".dsr")`;
- $number = ($number * $srate * $srate) / 2.0;
- break;
- }
- }
- }
- }
-
- if ($number > $numTri)
- {
- print (" - " + $nodeName + " has a high tessellation count of at least " + $number + "\n");
- print " triangles. It will be worthwhile to reduce the tessellation amount.\n";
- }
-
- if (`getAttr ($nodeName + ".du")` == 1 || `getAttr ($nodeName + ".dv")` == 1)
- {
- if (!$expert)
- {
- if (!$minimal_subdiv)
- {
- print (" - " + $nodeName + " is a degree 1 surface. You can usually get\n");
- print " away with setting the tessellation at its minimum without loss of\n";
- print " rendering quality.\n";
- }
- }
- else
- {
- if (($modeU == 3 && ($valueU > 1 || $valueV > 1)) ||
- ($modeU == 1 && ($valueU > $spansU+1 || $valueV > $spansV+1)))
- {
- print (" - " + $nodeName + " is a degree 1 surface. You can usually get\n");
- print " away with setting the tessellation at its minimum without loss of\n";
- print " rendering quality.\n";
- }
- }
- }
- }
-
-
- global proc zeroScale_problem()
- {
- string $globals[] = `ls -head 1 -renderGlobals`;
- string $optimizeInstancesAttr = $globals[0] + ".optimizeInstances";
- int $optimizeInstances = `getAttr $optimizeInstancesAttr`;
-
- if ($optimizeInstances)
- {
- string $allTransforms[] = `ls -transforms`;
-
- for ($transform in $allTransforms)
- {
- float $tScale[] = `xform -q -r -s $transform`;
- int $finished = false;
- for ($i=0; $i < 3 && !$finished; $i++)
- {
- if ($tScale[$i] <= .0002 && $tScale[$i] >= -.0002)
- {
- $finished = true;
- print (" - " + $transform + " has zero scale. This can be a problem\n");
- print " for optimize instances, so either turn optimize instances off\n";
- print " in renderGlobals or make it invisible instead of zero scale.\n";
- print " Zero-scale may also have problems with texture maps or shadow maps.\n";
- }
- }
- }
- }
- }
-
-
- //
- // check for the case where lightGlow/Fog geometry is being computed in the rendering
- // but no glow/fog effects will show up in the final image.
- //
- global proc volumeGeomTest()
- {
- // get all the lightGlow node
- string $allLightGlow[] = `ls -type opticalFX`;
- int $i;
- for ($i = 0; $i < size($allLightGlow); $i++)
- {
- //
- // We check for all opticalFX.message connections:
- //
- // if the glowVisibility is connected to some shape and
- // if that shape belongs to some shadingGroup and
- // if none of the message connections is made to the postProcessList1
- //
- // then we have the case, where the geometry will be processed for visibility
- // and yet no lightGlow will show up in the final image!
- //
- string $geomShape[] = `listConnections -sh true ($allLightGlow[$i] + ".glowVisibility")`;
- string $lightName[] = `listConnections ($allLightGlow[$i] + ".glowVisibility")`;
- if ($geomShape[0] != "")
- {
- //
- // there is a geometry representing glowVisibility
- //
- string $sets[] = `listConnections ($geomShape[0] + ".iog")`;
- int $j;
- for ($j = 0; $j < size($sets); $j++)
- if (`objectType ($sets[$j])` == "shadingEngine" &&
- `sets -q -renderable ($sets[$j])`) break;
-
- if ($j != size($sets))
- {
- //
- // the glow geometry belongs to some shadingGroup, it will be rendered!
- //
- // now make sure one of lightGlow.message is connected to postPorcessList1
- //
- string $msgConnections[] = `listConnections ($allLightGlow[$i] + ".message")`;
- int $activeGlow = 0;
- for ($j = 0; $j<size($msgConnections) && ($activeGlow==0); $j++) {
- //
- // determine if the lightGlow is active by checking if it is connected
- if ($msgConnections[$j] == "postProcessList1")
- $activeGlow = 1;
- }
- if ($activeGlow==0) {
- print (" - " + $allLightGlow[$i] + " Light glow for (" + $lightName[0] + ") is not connected to the postProcessList1.\n");
- print (" This will slow down the renderer and yet light glow for this node will not\n");
- print (" appear in the final rendering. \n");
- }
- }
- }
- else
- {
- print (" - " + $allLightGlow[$i] + " does not have a geometry connected to the glowVisibility attribute.\n");
- print (" This lightGlow can never be occluded.\n");
- }
- }
-
- //
- // OK, now get all the renderSphere, renderCone, and directedDisc and make sure
- // They are not just dangling there.
- string $miscShapes[] = `ls -type renderCone -type renderSphere -type directedDisc`;
- for ($i = 0; $i < size($miscShapes); $i++)
- {
- string $connectedNodes[] = `listConnections $miscShapes[$i]`;
- int $numConnected = size($connectedNodes);
- for ($j = 0; $j < $numConnected; $j++) {
- string $nodeType = `objectType $connectedNodes[$j]`;
- switch ($nodeType)
- {
- case "shadingEngine":
- if ($numConnected < 2) {
- print (" - " + $miscShapes[$i] + " is probably a residue of light fog/glow creation/disconnection.\n");
- print (" Rendering will slow down and yet there will be no effect on the final image.\n");
- }
- break;
- }
- }
- }
- }
-